home *** CD-ROM | disk | FTP | other *** search
- head 1.3;
- access;
- symbols;
- locks; strict;
- comment @ * @;
-
-
- 1.3
- date 92.08.18.04.46.58; author dglattin; state Exp;
- branches;
- next 1.2;
-
- 1.2
- date 92.04.13.11.43.08; author dennisg; state Exp;
- branches;
- next 1.1;
-
- 1.1
- date 91.12.09.01.07.13; author dennisg; state Exp;
- branches;
- next ;
-
-
- desc
- @This file contains definitions and possibly implementations
- of a set of routines for mutual exclusion.
- @
-
-
- 1.3
- log
- @Saving a working version before release.
- @
- text
- @/* -*-c-*- */
-
- /* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
-
- This file is part of GNU CC.
-
- GNU CC is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- GNU CC is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU CC; see the file COPYING. If not, write to
- the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
- /* As a special exception, if you link this library with files
- compiled with GCC to produce an executable, this does not cause
- the resulting executable to be covered by the GNU General Public License.
- This exception does not however invalidate any other reasons why
- the executable file might be covered by the GNU General Public License. */
-
- /*
- $Header: /usr/user/dennis_glatting/ObjC/c-runtime/dispatch.common/RCS/mutex.h,v 1.2 1992/04/13 11:43:08 dennisg Exp dennisg $
- $Author: dennisg $
- $Date: 1992/04/13 11:43:08 $
- $Log: mutex.h,v $
- * Revision 1.2 1992/04/13 11:43:08 dennisg
- * Check in after array version of run-time works.
- * Expect more changes as hash version and other changes are made.
- *
- * Revision 1.1 1991/12/09 01:07:13 dennisg
- * Initial revision
- *
- */
-
-
- #ifndef _MUTEX_H
- #define _MUTEX_H
-
- #ifdef WANT_MUTEX
- #if defined(NeXT)
- #include <cthreads.h>
- #define MUTEX mutex_t
- #define MUTEX_ALLOC(mutex) { *mutex = mutex_alloc(); }
- #define MUTEX_INIT(mutex) mutex_init(mutex)
- #define MUTEX_FREE(mutex) mutex_free(mutex)
- #define MUTEX_LOCK(mutex) mutex_lock(mutex)
- #define MUTEX_UNLOCK(mutex) mutex_unlock(mutex)
- #define MUTEX_ISLOCK(mutex) mutex->lock /* Gak */
-
- #elif defined(OSF)
-
- #elif defined(mach)
-
- #elif defined(sun)
- /*
- * Sun lwp uses monitors.
- *
- * Untested. 8-Dec-91, dennisg.
- */
- #include <lwp/lwp.h>
- #include <assert.h>
- #define MUTEX (mon_t)
- inline MUTEX
- MUTEX_ALLOC(mutex) {
-
- MUTEX mon;
-
- mon_create (&mon);
- return mon;
- }
- #define MUTEX_INIT(mutex)
- #define MUTEX_FREE(mutex) mon_destroy(mutex)
- inline void
- MUTEX_LOCK(mutex) {
-
- int nestingLevel = mon_enter(mutex);
- assert(nestingLevel);
- }
- #define MUTEX_UNLOCK(mutex) mon_exit(mutex)
- inline int
- MUTEX_ISLOCK(mutex) {
-
- thread_t aThread;
-
- /* Won't work? */
- return mon_waiters( mutex, &aThread, NULL, 0);
- }
-
- #elif defined(COROUTINES)
- /*
- * A environment where threads are implemented as a
- * set of coroutines.
- */
-
- #endif
- #endif
-
- #ifndef MUTEX
- /*
- * These are default mutex handler routines.
- * There is no mutex support.
- *
- * Let the optimizer get rid of mutexes.
- */
-
- #define MUTEX void*
- #define MUTEX_ALLOC(mutex) (MUTEX)-1
- #define MUTEX_INIT(mutex) (mutex)
- #define MUTEX_FREE(mutex) (mutex)
- #define MUTEX_LOCK(mutex) (mutex)
- #define MUTEX_UNLOCK(mutex) (mutex)
- #define MUTEX_ISLOCK(mutex) 1
- #endif
-
- #endif
- @
-
-
- 1.2
- log
- @Check in after array version of run-time works.
- Expect more changes as hash version and other changes are made.
- @
- text
- @d1 28
- a28 24
- /* -*-c-*-
- * This file contains host specific definitions or linkage to
- * a set of mutual exclusion routines.
- *
- * Mutual exclusion is accomplished by a small set of
- * definitions. These definitions mimic Mach's mutex
- * variables.
- *
- * Copyright (C) 1991 Threaded Technologies Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 1, or any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should receive a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- $Header: /usr/user/dennis_glatting/ObjC/c-runtime/lib/RCS/mutex.h,v 1.1 1991/12/09 01:07:13 dennisg Exp dennisg $
- d30 1
- a30 1
- $Date: 1991/12/09 01:07:13 $
- d32 4
- d54 1
- a54 1
- #define MUTEX_ISLOCK(mutex) mutex->lock /* Gak */
- d89 1
- a89 1
- thread_t aThread;
- d91 2
- a92 2
- /* Won't work? */
- return mon_waiters( mutex, &aThread, NULL, 0);
- d114 5
- a118 5
- #define MUTEX_INIT(mutex) (mutex)
- #define MUTEX_FREE(mutex) (mutex)
- #define MUTEX_LOCK(mutex) (mutex)
- #define MUTEX_UNLOCK(mutex) (mutex)
- #define MUTEX_ISLOCK(mutex) 1
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d24 1
- a24 1
- $Header: /usr/user/dennis_glatting/ObjC/c-runtime/lib/RCS/hash.c,v 0.9 1991/12/03 02:01:23 dennisg Exp dennisg $
- d26 5
- a30 2
- $Date: 1991/12/03 02:01:23 $
- $Log: hash.c,v $
- d37 1
- d40 2
- a41 2
- #define MUTEX (mutex_t)
- #define MUTEX_ALLOC(mutex) mutex_alloc(mutex)
- d46 1
- d78 2
- d81 6
- d93 4
- a96 1
- #else
- d103 2
- a104 1
- #define MUTEX (void*)
- d106 6
- a111 4
- #define MUTEX_INIT(mutex)
- #define MUTEX_FREE(mutex)
- #define MUTEX_LOCK(mutex)
- #define MUTEX_UNLOCK(mutex)
- @
-